/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.velocityme.entity;

import com.velocityme.enums.NotificationMechanism;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

/**
 *
 * @author rcrida
 */
@Entity
@NamedQueries( {
    @NamedQuery(name="findAllContactDetailTypes",
                query="SELECT c FROM ContactDetailType c ORDER BY c.sequenceNumber"),
    @NamedQuery(name="findContactDetailTypeByName",
                query="SELECT c FROM ContactDetailType c WHERE c.name = :name"),
    @NamedQuery(name="findContactDetailTypeInDirectory",
                query="SELECT c FROM ContactDetailType c WHERE c.showInDirectory = TRUE ORDER BY c.sequenceNumber")
})
public class ContactDetailType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private String name;

    private boolean showType;

    private boolean showInDirectory;

    private int sequenceNumber;

    private NotificationMechanism notificationMechanism;

    protected ContactDetailType() {
    }
    
    public ContactDetailType(NotificationMechanism notificationMechanism, String name, boolean showType, boolean showInDirectory, int sequenceNumber) {
        this.name = name;
        this.showType = showType;
        this.showInDirectory = showInDirectory;
        this.sequenceNumber = sequenceNumber;
        this.notificationMechanism = notificationMechanism;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public int getSequenceNumber() {
        return sequenceNumber;
    }

    public NotificationMechanism getNotificationMechanism() {
        return notificationMechanism;
    }

    public boolean isShowType() {
        return showType;
    }

    public boolean isShowInDirectory() {
        return showInDirectory;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ContactDetailType)) {
            return false;
        }
        ContactDetailType other = (ContactDetailType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.velocityme.entity.ContactDetailType[id=" + id + "]";
    }

}
